<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="checkbox" name="hobby" id=""> 滑雪
    <input type="checkbox" name="hobby" id=""> 潜水
    <input type="checkbox" name="hobby" id=""> 打出溜滑
    <input type="checkbox" name="hobby" id=""> 憋气儿
    <span name="hobby">我是span</span>
    <script>
        /**
         * 通过元素标签的name属性获取元素
         * 
         */
        var names = document.getElementsByName('hobby');// NodeList 集合，也是一个伪数组
        console.log(names);
    </script>
</body>
</html>